import React from 'react';
import ContactMailOutlined from '@material-ui/icons/ContactMailOutlined';
import { NavView, get_mod, NavListSub, loc } from 'sui';
import { UserView } from './user';
import { GroupView } from './group/view';

const model = (cfg) => {
    const fix = [
        {uid: "supply.user", view: UserView, value: loc("l_739")},
        {uid: "supply.group", view: GroupView, value: loc("l_710")},
    ];

    return get_mod(cfg, fix, "supply");
};

const Supply = ({ mod, setEvent, sideopen, cfg }) => <NavView cfg={cfg} model={model(cfg)} mod={mod} setEvent={setEvent} sideopen={sideopen} name="supply"/>;

const NavSupply = (props) => <NavListSub icon={<ContactMailOutlined/>} sub={model(props.cfg)} {...props} scut={15}/>;

export {NavSupply, Supply};
